<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		
	</body>
	<script type="text/javascript">
		//构造函数模式 
			//小明 今年18岁 性别男 有男朋友 男朋友会说话 说什么自己定
		
		
		function fun(name,age,boyfriend,job){
			this.name = name,
			this.age = age,
			this.boyfriend = boyfriend,
			this.job = job
			this.say = function(){
				alert("我是"+this.name+"的"+this.boyfriend+"他今年"+this.age+"岁我会"+this.job)
			}
		}
		var day = new fun("小明",18,"boyfriend","说话");
		day.say();
		
		//工厂模式
			//造一辆车 出厂 （合格证/建议零售价/说明书）
		
		function fun2(vehicle,leave,quality,retail,book){
			var ev = Object();
			ev.vehicle = vehicle;
			ev.leave = leave;
			ev.quality = quality;
			ev.retail = retail;
			ev.book = book;
			ev.say = function(){
				alert("这是一辆:"+this.vehicle+",出厂时间是："+this.leave+",合格证:"+this.quality+",建议零售价:"+this.retail+",说明:"+this.book)
			}
			return ev;
		}
		var vehicle = fun2("别克 君威","2017-7-18","合格证是汽车另一个重要的凭证，也是汽车上户时必备的证件。只有具有合格证的汽车才符合国家对机动车装备质量及有关标准的要求","22.28-24.58万元","2017年7月21日，别克全新一代君威正式登陆中国市场。新车共推出10款车型。");
		
		
		
		
		vehicle.say();
		
		
		
			
		
	</script>
</html>
